home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
cjdates.exe
/
DATES.INC
< prev
next >
Wrap
Text File
|
1991-07-07
|
2KB
|
60 lines
{
dates.inc
This Turbo Pascal Include file contains several routines to aid in date
processing and display.
YDay, given a Gregorian date, returns the Julian Day of the Year.
DOW, given a number 0-6 returns a string giving the Day of the Week.
MonthName, given a month number (1-12) returns the name of the month.
WARNING! Don't forget that "YDay" requires that you place a "uses Dates"
at the beginning of the program!!!
AND REMEMBER--The Year you supply to YDay must be the full year, NOT the
last two digits!!}
{(c)Copyright 1991 Crazy Jack}
{All Rights Reserved}
{----------------------------------- YDay -----------------------------------}
function YDay( Year, Month, Day : word {Caller-supplied Gregorian date.}
) : word; {Function returns Julian year-day.}
begin
YDay := word( ZDay(Year, Month, Day) - ZDay(Year, 1, 0) )
end;
{------------------- Type used by BOTH DOW and MonthName --------------------}
type
DatesStr9 = string[9]; {No need to allocate 256 bytes}
{somewhere.}
{----------------------------------- DOW ------------------------------------}
function DOW( DNmbr : word {Caller-supplied day-of-week number.}
) : DatesStr9; {Returned string naming the day.}
const
WT : array[0..7] of DatesStr9 = ('Sunday', 'Monday', 'Tuesday',
'Wednesday', 'Thursday', 'Friday',
'Saturday', 'NotADay');
begin
DOW := WT[DNmbr and 7]
end;
{-------------------------------- MonthName ---------------------------------}
function MonthName( MNmbr : word {Caller-supplied month number.}
) : DatesStr9; {Returned string naming the month.}
const
MT : array[0..15] of DatesStr9 = ('Caligula', 'January', 'February',
'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October',
'November', 'December', 'Caligula',
'Caligula', 'Caligula');
begin
MonthName := MT[MNmbr and 15]
end;